<!--资源调查-->
<template>
  <div class="tariff-verification-box pending-task">
    <PPMPage
        v-if="pageData.length > 0"
        :formData="formData"
        :pageData="pageData"
    >
      <template slot="footer" class="dialog-footer">
        <el-row>
          <el-col :span="24" class="text-center">
            <el-button type="primary" size="medium" @click="submitFun">保存</el-button>
            <el-button size="medium" @click="closeFun">取消</el-button>
          </el-col>
        </el-row>
      </template>
    </PPMPage>
  </div>
</template>
<script>
import ppmmixin from "@/mixins/ppmmixin.js";
import ppmTaskInit from "@/mixins/custorder/ppmTaskInit";
import requestUtil from '@/utils/requestEnc';
import CustOrderService from "@/api/order/CustOrderService";
import { mapState } from "vuex";
import custOrderDetail from '@/mixins/custorder/custOrderDetail';
export default {
  name: "TariffVerification",
  mixins: [ppmTaskInit,ppmmixin,custOrderDetail],
  data() {
    return {
      odtals:null
    }
  },
  props: {
    ODKInfo: {
      type: Object
    },
    CTOInfo: {
      type: [Object,Array]
    }
  },
  computed: {
    ...mapState('orders',['orderPosInfo']),
    ...mapState('user',['user'])
  },
  mounted() {

  },
  created() {
    // this.submitFun();
    this.getCustomerOrderDetail(this.Form,this.CTOInfo,this.ODKInfo);
  },
  components: {

  },
  methods: {
    async submitFun(){
      let base={
        userName: this.user.staffName,
        userId: this.user.staffId,
        orgId: this.user.orgId,
        actType: 'MOD',
        oneOrmany:'one'
      };
      let {userId,orgId} = base,
          {custId,orderItemSeqs,custSoNumber,orderItemIds,orderItemId} = this.CTOInfo,
          {orderAuditId,taskId,activityId,processInstId} = this.ODKInfo;
      let param = requestUtil.paramEnc(this.Form,Object.assign(this.ODKInfo,this.CTOInfo,base,this.odtals));
      let allParam = {orderAuditId,orderItemIds,custId,activityId,processInstId,orderItemSeqs,custSoNumber,orderItemId,userId,orgId,taskId,...base,...param};
      const result = await CustOrderService.saveResourceVerification(allParam);
      try {
        if(result.meta.resultCode == 0){
          this.$message({
            type: 'success',
            message: '保存成功!'
          });
          this.$emit('update:show',false);
        }else{
          this.$message({
            showClose: true,
            message: result.meta.resultMsg,
            type: 'error'
          });
        }
      } catch {
        this.$message({
          showClose: true,
          message: 'code:'+result.code+'  msg:'+result.msg,
          type: 'error'
        });
      }
    },
    closeFun(){
      this.$emit('update:show',false)
    }
  }
}
</script>

<style lang="scss" scoped>
.tariff-verification-box{
  height: 84vh;
  overflow-y: auto;
}
</style>

